﻿using Furion.ConfigurableOptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace edan.zhjk.Commons.DBOption
{
    /// <summary>
    /// 数据库连接配置项
    /// </summary>
    public class DBOptions : IConfigurableOptions
    {
        /// <summary>
        /// 多库链接
        /// </summary>
        public List<MutiDBConns>? MutiDBConns { get; set; }
    }

    /// <summary>
    /// 多数据原配置
    /// </summary>
    public class MutiDBConns
    {
        /// <summary>
        /// 连接启用开关
        /// </summary>
        public bool Enabled { get; set; }

        /// <summary>
        /// 连接ID
        /// </summary>
        public string? ConnId { get; set; }

        /// <summary>
        /// 连接字符串
        /// </summary>
        public string? Connection { get; set; }

        /// <summary>
        /// 数据库类型
        /// </summary>
        public DataBaseType DbType { get; set; }

        /// <summary>
        /// 最大数据长度
        /// </summary>
        public int MaxLongData { get; set; }

        /// <summary>
        /// 秘钥
        /// </summary>
        public string? ApiKey { get; set; }
    }

    /// <summary>
    /// 数据库类型
    /// </summary>
    public enum DataBaseType
    {
        PostgreSQL = 1,
        MySql = 2,
        SqlServer = 3,
        Sqlite = 4,
        Oracle = 5,
        Dm = 6,
        Kdbndp = 7,
        Virtuoso = 20
    }
}
